/*
 * Copyright (c) 2020, 2023, 3044483124@qq.com All rights reserved.
 *
 */
package cn.itcast;

import java.util.Random;

/**
 * <p>Project: JavaStudy - If1
 * <p>Powered by jiangbo On 2023-02-25
 * 10:44:57
 * <p>Created by IntelliJ IDEA
 *
 * @author jiangbo [3044483124@qq.com]
 * @version 1.0
 * @since 8/17
 */
public class If1 {
    public static void main(String[] args) {
        Random rand = new Random();

        for (int i=0;i<10;i++){
            System.out.print("循环"+i+"：");
            //if简单写法
            System.out.print(rand.nextBoolean());
            if (rand.nextBoolean()) {
                System.out.println(" "+"ok");
            }else {
                System.out.println(" "+"bad data");
            }
            //判断某年是不是闰年
            int year = rand.nextInt(1900, 2023);
            System.out.printf("%d 年%n", year);
            if (year % 400 == 0 || year % 4 == 0 && year % 100 != 0) {
                System.out.printf("%d年是闰年%n", year);
            } else {
                System.out.printf("%d年是平年%n", year);
            }
        }
        System.out.println("#".repeat(35));
        for (int i=1900;i<2023;i++){

            if (i % 400 == 0 || i % 4 == 0 && i % 100 != 0) {
                System.out.printf("%d年是闰年%n", i);
            } else {
                System.out.printf("%d年是平年%n", i);
            }

        }


    }
    }


